<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>用户列表</h2>
	</div>
	<div class="cf">
		<div class="fl">
            <a class="btn" href='javascript:;' onclick='edit()'>新 增</a>
            <button class="btn ajax-post" url="{:U('User/changeStatus',array('method'=>'resumeUser'))}" target-form="ids">启 用</button>
            <button class="btn ajax-post" url="{:U('User/changeStatus',array('method'=>'forbidUser'))}" target-form="ids">禁 用</button>
            <button class="btn ajax-post confirm" url="{:U('User/changeStatus',array('method'=>'deleteUser'))}" target-form="ids">删 除</button>
        </div>
        <!-- 高级搜索 -->
		<div class="search-form fr cf">
			<div class="sleft">
				<input type="text" name="nickname" class="search-input" value="{:I('nickname')}" placeholder="请输入用户昵称或者ID">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
			</div>
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
		<th class="">编号</th>
		<th class="">名称</th>
		<th class="">代码</th>
		<th class="">描述</th>
		<th class="">状态</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.shipping_id}" /></td>
			<td>{$vo.shipping_id} </td>
			<td>{$vo.shipping_name}</td>
			<td>{$vo.shipping_code}</td>
			<td><a href="javascript:;" title='{$vo.shipping_desc}'></a>{$vo.shipping_desc|mb_substr=###,0,10}</td>
			<td><a href="javascript:;" id="a{$vo.shipping_id}" onclick='changeStatus("{$vo.shipping_id}","{$vo.enabled}" )'><eq name='vo.enabled' value='1'><img src="/Public/images/yes.png" title="已启用"><else /><img src="/Public/images/cancel.png" title="未启用"></eq></a></td>
			<td>
				<a href="javascript:;" title="编辑" onclick="edit( '{$vo.shipping_id}')" ><img src="/Public/images/edit.png" ></a>
				<a  href="javascript:;" title="删除"  onclick="del('{$vo.shipping_id}')" ><img src="/Public/images/delete.png" alt="">
				<a  href="{:U('config',array('code'=>$vo['shipping_code']))}" title="配置"><img src="/Public/images/config.png" alt=""></a>
			</td>
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>
<block name="script">
	<script type="text/javascript">
		function changeStatus(id,status){
			if(status == 0){
				status = 1 ;
			}else{status = 0;}
			$.post('__SELF__' , {id:id,status:status,type:'change'},function(data){
				if(data.status){
					window.location.reload();
				}else{
					layer.msg(data.info);
				}
				
			},'json');
		}

		function del(id){
			$.post('__SELF__' , {id:id,type:'del'} , function(data){
				if(data.status){
					$this.parent().remove();
				}else{
					layer.msg(data.info);
				}
			});
		}

		function edit(id){
			var url ; 
			if(id){
				url = "{:U('edit')}&id=" +id ;
			}else{
				url = "{:U('edit')}";
			}
			layer.open({
					  type: 2,
					  title: '编辑',
					  area: ['490px', '386px'], 
					  content:url
				});
		}

	</script>
</block>